/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hitechbangla.fctu.base.weather;

import com.hitechbangla.fctu.base.GameScene;
import com.hitechbangla.fctu.base.Location;
import fctu.simulator.HTB_MAIN;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import java.io.Serializable;

/**
 *
 * @author ASUS
 */
public class RandomCloud implements Serializable
{
    
    private Location location;
    private float dimension;

    private Point2D.Double[] dots;
    private int dotsSize;
   
   
    public RandomCloud(int n)
    {  
        dots = new Point2D.Double[n];
        dotsSize = 0;
    }

   /**
      Sets a dot point of the cloud. The point is
      ignored if the maximum number of points has been added.
      @param p the dot point 
   */
   public void add(Point2D.Double p)
   {  
        if (dotsSize < dots.length)
        {  
            dots[dotsSize] = p;
            dotsSize++;
        }
   }
   
   /**
      Draws the cloud.
      @param g2 the graphics context
   */
   public void draw(Graphics g) 
   {  
//       Graphics2D g2d = (Graphics2D)g;
//       final double SMALL_CIRCLE_RADIUS = 2;
//   
//        for (int i = 0; i < dotsSize; i++)
//        {  
//            
//            Ellipse2D.Double smallCircle 
//              = new Ellipse2D.Double(
//              dots[i].getX() - SMALL_CIRCLE_RADIUS,
//              dots[i].getY() - SMALL_CIRCLE_RADIUS, 
//              2 * SMALL_CIRCLE_RADIUS, 
//              2 * SMALL_CIRCLE_RADIUS);
//
//           g2d.setColor(Color.RED);
//           g2d.fill(smallCircle);
//           
//        }
       for (int i = 0; i < dotsSize; i++)
        { 
       int x = (int) (dots[i].getX() * HTB_MAIN.one_px_equivalent_naut);
        int y = (int) (dots[i].getY() * HTB_MAIN.one_px_equivalent_naut);
        
        Color color = g.getColor();
        g.setColor(Color.WHITE);
        g.fillOval(x-GameScene.rectSize/2, y-GameScene.rectSize/2, GameScene.rectSize, GameScene.rectSize);
       
        }
   }   
   
   public Location getLocation() {
	return location;
    }

    /**
     * @param location the location to set
     */
    public void setLocation(Location location) {
	this.location = location;
    }

    /**
     * @return the dimension
     */
    public float getDimension() {
	return dimension;
    }

    /**
     * @param dimension the dimension to set
     */
    public void setDimension(float dimension) {
	this.dimension = dimension;
    }
    
    
}
